package com.eastfair.security.util;

import cn.hutool.core.util.StrUtil;
import com.eastfair.core.context.ContextUtil;
import com.eastfair.core.snowflake.DefaultUidGenerator;
import com.eastfair.uid.model.SelfUidDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TenantUtil {

//    @Autowired
//    SelfUidService selfUidService;

    public String getTenant() {
        if (ContextUtil.getProjectId() != null) {
//            SelfUidDto selfUidDto = selfUidService.parseUid(ContextUtil.getProjectId());
            return StrUtil.format("{}{}", "ds-", DefaultUidGenerator.parseUid(ContextUtil.getProjectId()));
        }
        return null;
    }
}
